package com.ssy.lingxi.order.entity;

import javax.persistence.*;
import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;

/**
 * 订单商品交易记录
 * @author 万宁
 * @version 2.0.0
 * @date 2021-07-29
 */
@Entity
@Table(schema = "public", name = "ord_product_history", indexes = {
        @Index(name = "ord_product_history_buyer_member_idx", columnList = "buyerMemberId, buyerRoleId"),
        @Index(name = "ord_product_history_vendor_member_idx", columnList = "vendorMemberId, vendorRoleId"),
        @Index(name = "ord_product_history_shop_id_idx", columnList = "shopId"),
        @Index(name = "ord_product_history_product_id_idx", columnList = "productId")})
public class OrderProductHistoryDO implements Serializable {
    private static final long serialVersionUID = 4425503835408719255L;

    /**
     * 主键Id
     */
    @Id
    @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "ord_product_history_seq")
    @SequenceGenerator(sequenceName = "ord_product_history_seq", name = "ord_product_history_seq", allocationSize = 1)
    private Long id;

    /**
     * 创建时间（订单完成时间）
     */
    @Column(columnDefinition = "timestamp")
    private LocalDateTime createTime;

    /**
     * 买方（采购）会员Id
     */
    @Column
    private Long buyerMemberId;

    /**
     * 采购会员角色Id
     */
    @Column
    private Long buyerRoleId;

    /**
     * 采购会员名称
     */
    @Column(columnDefinition = "varchar(200)")
    private String buyerMemberName;

    /**
     * 卖方（供应）会员Id
     */
    @Column
    private Long vendorMemberId;

    /**
     * 卖方（供应）会员角色Id
     */
    @Column
    private Long vendorRoleId;

    /**
     * 订单来源商城，定义在OrderSourceEnum中（待修改）
     */
    @Column
    private Long shopId;

    /**
     * 订单来源商城的类型，定义在 ShopTypeEnum 中
     */
    @Column
    private Integer shopType;

    /**
     * 订单来源商城的环境，定义在 ShopEnvironment 中
     */
    @Column
    private Integer shopEnvironment;

    /**
     * 订单Id
     */
    @Column
    private Long orderId;

    /**
     * 商品Id（来自商品服务）
     */
    @Column
    private Long productId;

    /**
     * 商品SkuId
     */
    @Column
    private Long skuId;

    /**
     * 计价单位
     */
    @Column(columnDefinition = "varchar(10)")
    private String unit;

    /**
     * 采购数量
     */
    @Column(columnDefinition = "numeric(15,4)")
    private BigDecimal quantity;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public LocalDateTime getCreateTime() {
        return createTime;
    }

    public void setCreateTime(LocalDateTime createTime) {
        this.createTime = createTime;
    }

    public Long getBuyerMemberId() {
        return buyerMemberId;
    }

    public void setBuyerMemberId(Long buyerMemberId) {
        this.buyerMemberId = buyerMemberId;
    }

    public Long getBuyerRoleId() {
        return buyerRoleId;
    }

    public void setBuyerRoleId(Long buyerRoleId) {
        this.buyerRoleId = buyerRoleId;
    }

    public String getBuyerMemberName() {
        return buyerMemberName;
    }

    public void setBuyerMemberName(String buyerMemberName) {
        this.buyerMemberName = buyerMemberName;
    }

    public Long getVendorMemberId() {
        return vendorMemberId;
    }

    public void setVendorMemberId(Long vendorMemberId) {
        this.vendorMemberId = vendorMemberId;
    }

    public Long getVendorRoleId() {
        return vendorRoleId;
    }

    public void setVendorRoleId(Long vendorRoleId) {
        this.vendorRoleId = vendorRoleId;
    }

    public Long getShopId() {
        return shopId;
    }

    public void setShopId(Long shopId) {
        this.shopId = shopId;
    }

    public Integer getShopType() {
        return shopType;
    }

    public void setShopType(Integer shopType) {
        this.shopType = shopType;
    }

    public Integer getShopEnvironment() {
        return shopEnvironment;
    }

    public void setShopEnvironment(Integer shopEnvironment) {
        this.shopEnvironment = shopEnvironment;
    }

    public Long getOrderId() {
        return orderId;
    }

    public void setOrderId(Long orderId) {
        this.orderId = orderId;
    }

    public Long getProductId() {
        return productId;
    }

    public void setProductId(Long productId) {
        this.productId = productId;
    }

    public Long getSkuId() {
        return skuId;
    }

    public void setSkuId(Long skuId) {
        this.skuId = skuId;
    }

    public String getUnit() {
        return unit;
    }

    public void setUnit(String unit) {
        this.unit = unit;
    }

    public BigDecimal getQuantity() {
        return quantity;
    }

    public void setQuantity(BigDecimal quantity) {
        this.quantity = quantity;
    }
}
